package com.backend.struts;

import com.backend.models.Order;
import lombok.Data;
import org.apache.http.client.utils.DateUtils;

import java.io.Serializable;
import java.util.Date;

@Data
public class OrderObj implements Serializable {
    public Integer id;
    public Integer buyerId;
    public Integer salerId;
    public ProductObj product;
    public Order.ORDER_STATUS buyStatus;
    public Order.SALE_STATUS saleStatus;
    public Double expressFee;
    public Double price;
    public String lastModifyTime;
    public UserInfo user;

    public OrderObj() {
    }

    public OrderObj(Order order) {
        this.id = order.id;
        this.buyerId = order.userId;
        this.salerId = order.salerId;
        this.buyStatus = order.status;
        this.saleStatus = order.saleStatus;
        this.expressFee = order.expressFee;
        this.price = order.price;
        this.lastModifyTime = DateUtils.formatDate(order.createTime,"yyyy-MM-dd hh:mm:ss");
    }
}
